<?php
$form = $this->beginWidget('CActiveForm', array(
    'id' => 'site-products-form',
    'enableAjaxValidation' => false,
    'htmlOptions' => array('enctype' => 'multipart/form-data'),
        ));
?>
<div class="block">
    <div class="alert alert_grey">
        <img height="24" width="24" src="<?php echo Yii::app()->params['backendUrl']; ?>/images/icons/small/grey/alert_2.png">
        Fields with <span class="required"><strong>*</strong></span> are required.
    </div>

    <p class="note">Fields with <span class="required">*</span> are required.</p>

    <?php echo $form->errorSummary($model); ?>

    <div class="input_group">
        <?php echo $form->labelEx($model, 'products_products_category_id'); ?>
        <?php echo $form->dropDownList($model, 'products_products_category_id', CHtml::listData(site_products_category::model()->findAll(), 'products_category_id', 'products_category_title'), array('prompt' => 'Please Select Category')); ?>
        <?php //echo $form->error($model, 'products_products_category_id'); ?>
    </div>

    <?php echo $form->labelEx($model, 'products_title'); ?>
    <?php echo $form->textField($model, 'products_title', array('size' => 60, 'maxlength' => 100)); ?>
    <?php //echo $form->error($model, 'products_title'); ?>
    
    <div class="input_group">
        <?php echo $form->labelEx($model, 'products_short_description'); ?>
        <?php
        $this->widget('application.extensions.ckeditor.CKEditor', array(
            "model" => $model,
            "attribute" => 'products_short_description',
            "width" => '100%',
            "toolbar" => "Basic",
                )
        );
        ?>
        <?php //echo $form->error($model, 'products_short_description'); ?>
    </div>
    
    <div class="input_group">
        <?php echo $form->labelEx($model, 'products_description'); ?>
        <?php
        $this->widget('application.extensions.ckeditor.CKEditor', array(
            "model" => $model,
            "attribute" => 'products_description',
            "width" => '100%',
            "toolbar" => "Basic",
                )
        );
        ?>
        <?php //echo $form->error($model, 'products_description'); ?>
    </div>
    
    <div class="input_group">
        <?php echo $form->labelEx($model, 'products_thumbnail'); ?>
        <?php
        if(!$model->isNewRecord && $model->products_thumbnail != null) {
            echo '<div>'.CHtml::image(Yii::app()->params['config']['dir']['products'].$model->products_thumbnail, (($model->products_thumbnail != null) ? $model->products_title : ''), array('width' => 100)).'</div>';
        }
        ?>
        <?php echo CHtml::activeFileField($model, 'products_thumbnail'); ?>
        <?php //echo $form->error($model, 'products_thumbnail'); ?>
    </div>
    
    <div class="input_group">
        <?php echo $form->labelEx($model, 'products_image'); ?>
        <?php
        if(!$model->isNewRecord && $model->products_image != null) {
            echo '<div>'.CHtml::image(Yii::app()->params['config']['dir']['products'].$model->products_image, (($model->products_image != null) ? $model->products_title : ''), array('width' => 100)).'</div>';
        }
        ?>
        <?php echo CHtml::activeFileField($model, 'products_image'); ?>
        <?php //echo $form->error($model, 'products_image'); ?>
    </div>

    <button class="button_colour round_all"><img height="24" width="24" alt="Bended Arrow Right" src="<?php echo Yii::app()->params['backendUrl']; ?>/images/icons/small/white/bended_arrow_right.png"><span><?php echo ($model->isNewRecord) ? 'Create' : 'Save'; ?></span></button>

</div>

<?php $this->endWidget(); ?>
<!-- form -->